package watercups.states;

import java.util.ArrayList;
import templates.State;

public class WaterCupState {
    protected int capacity1;
    protected int capacity2;

    WaterCupState(){
        capacity1=0;
        capacity2=0;
    }

    public boolean equals(Object obj) {
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        final WaterCupState other = (WaterCupState) obj;
        if (this.capacity1 != other.capacity1) {
            return false;
        }
        if (this.capacity2 != other.capacity2) {
            return false;
        }
        return true;
    }

    public int hashCode() {
        int hash = 7;
        hash = 37 * hash + this.capacity1;
        hash = 37 * hash + this.capacity2;
        return hash;
    }

    public WaterCupState(int capacity1, int capacity2){
        this.capacity1=capacity1;
        this.capacity2=capacity2;
    }

    public int getCapacity1(){
        return capacity1;
    }
    public int getCapacity2(){
        return capacity2;
    }
    public void setCapacity1(int capacity1){
        this.capacity1=capacity1;
    }
    public void setCapacity2(int capacity2){
        this.capacity2=capacity2;
    }

	public String toString() {
		return "Stare [cana 1=" + capacity1 + ", cana 2=" + capacity2 + "]";
	}

	public static ArrayList<State<WaterCupState>> finalState(){
        ArrayList<State<WaterCupState>> fStates=new ArrayList<State<WaterCupState>>();

        fStates.add(new State<WaterCupState>(new WaterCupState(0,2),null));
        fStates.add(new State<WaterCupState>(new WaterCupState(1,2),null));
        fStates.add(new State<WaterCupState>(new WaterCupState(2,2),null));
        fStates.add(new State<WaterCupState>(new WaterCupState(3,2),null));

        return fStates;
    }

    public static State<WaterCupState> initialState(){
        return new State<WaterCupState>(new WaterCupState(),new InitialState());
    }
}
